package test;

import java.awt.BorderLayout;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class MyFrame1 extends JFrame {
    public MyFrame1() {
        setTitle("Background Image Example");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(400, 300);

        JPanel panel = new JPanel(new BorderLayout());

        // Replace with your desired image file name or path
        ImageIcon imageIcon = new ImageIcon("C:\\Users\\hahon\\Desktop\\课设\\项目\\untitled1\\src\\main\\java\\微信图片_20231017150224.jpg");
        JLabel backgroundLabel = new JLabel(imageIcon);
        panel.add(backgroundLabel, BorderLayout.CENTER);

        add(panel);
    }

    public static void main(String[] args) {
        MyFrame1 frame = new MyFrame1();
        frame.setVisible(true);
    }
}